package com.xyh.controller;

import com.xyh.po.Home;
import com.xyh.service.HomeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.stereotype.Repository;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

import java.util.List;

/**
 * @Author:kyle
 * @Date:2020/12/23 - 23:27
 * @Project:spring_StudentsDormitoryManagementSystem
 * @Package:com.xyh.controller
 * @Version:1.0
 */
@Controller
public class HomeController {
    @Autowired
    private HomeService homeService;

    @RequestMapping("/home/fj")
    private ModelAndView listHomes(){

        ModelAndView modelAndView = new ModelAndView();
        List<Home> homes = homeService.list();
        modelAndView.addObject("homes",homes);
        modelAndView.setViewName("home");
        return modelAndView;
    }
}
